﻿@using ELTE.SEM.Data.ViewModels

@model SEMLogEntryPartViewModel
@{
    string partType = String.Concat("entry-type-", Model.EntryPartType.ToString().ToLower());
    string partTypeText = string.Empty;
    string partText = string.Empty;
    int partTypeInt = (int)Model.EntryPartType;
    switch (Model.EntryPartType)
    {
        case ELTE.SEM.Common.Enums.SemLogEntryPartType.DetectorRepair:
            partTypeText = "D";
            partText = Model.RepairDescriptions;
            break;
        case ELTE.SEM.Common.Enums.SemLogEntryPartType.GeneralRepair:
            partTypeText = "Sz";
            partText = Model.RepairDescriptions;
            break;
        case ELTE.SEM.Common.Enums.SemLogEntryPartType.InsertReplace:
            partTypeText = "I";
            partText = Model.PartDescriptions;
            break;
        case ELTE.SEM.Common.Enums.SemLogEntryPartType.SampleReplace:
            partTypeText = "M";
            partText = Model.PartDescriptions;
            break;
        case ELTE.SEM.Common.Enums.SemLogEntryPartType.StageStand:
            partTypeText = "St";
            partText = Model.PartDescriptions;
            break;
        case ELTE.SEM.Common.Enums.SemLogEntryPartType.Error:
            partTypeText = "E";
            partText = Model.ErrorDescriptions;
            break;
        case ELTE.SEM.Common.Enums.SemLogEntryPartType.BeamOn:
            partTypeText = "B [ON]";
            partText = Model.PartDescriptions;
            break;
        case ELTE.SEM.Common.Enums.SemLogEntryPartType.BeamOff:
            partTypeText = "B [OFF]";
            partText = Model.PartDescriptions;
            break;
        case ELTE.SEM.Common.Enums.SemLogEntryPartType.SEMStatus:
            partTypeText = "Á";
            partText = Model.PartDescriptions;
            break;
        default:
            break;

    }
}
<div class="entry-part" data-part-id="@Model.Id">
    <input type="hidden" class="entry-part-id" value="@Model.Id" />
    <input type="hidden" class="entry-part-type-id" value="@partTypeInt" />
    <div class="part-type-initial @partType">
        @partTypeText
    </div>
    <div class="part-description @partType">
        @if(!String.IsNullOrEmpty(partText )){
            <span>@MvcHtmlString.Create(partText.Replace("\n", "<br />").Replace("\t","    "))</span>
        }
    </div>
    <div class="entry-part-actions">
        <div class="part-edit" data-id="@Model.Id" data-entry-id="@Model.LogEntryId" >Szerkeszt</div>
        <div class="part-delete" data-id="@Model.Id" data-entry-id="@Model.LogEntryId" >Töröl</div>
    </div>
    
</div>
